/*
 * Copyright (c) 2020, 2023, 3044483124@qq.com All rights reserved.
 *
 */
package cn.image;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

/**
 * <p>Project: JavaStudy - WaterIma
 * <p>Powered by jiangbo On 2023-01-06
 * 21:07:24
 * <p>Created by IntelliJ IDEA
 *
 * @author jiangbo [3044483124@qq.com]
 * @version 1.0
 * @since 8/17
 */
public class WaterIma {
    public static void main(String[] args) {
        String file = "C:\\Users\\30444\\Desktop\\截图\\wang_001.png";
        try {
//读取磁盘上的图像文件
            BufferedImage img = ImageIO.read(new File(file));
//建立画笔
            Graphics2D g = img.createGraphics();

//水印文字
            String text = "版权所有 jiangbo";

//文字颜色
            Color color = Color.red;
//水印文字的坐标位置
            int x = 100;
            int y = 200;
            g.drawString(text, x, y);
            ImageIO.write(img, "png", new File("wang.png"));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }


    }
}


